package com.example.algorithm.sort;

/**
 * @program: algorithm
 * @description:
 * @packagename: com.example.algorithm.sort
 * @author: Jay
 * @date: 2022/03/25 14:49:03
 **/
public class BaseSort {

    /**
     * 比较a>b
     */
    public static boolean greater(Comparable a, Comparable b){
        return a.compareTo(b)>0;
    }

    /**
     * 比较a<b
     */
    public static boolean less(Comparable a, Comparable b){
        return a.compareTo(b)<0;
    }

    /**
     * 数组元素i，j交换位置
     */
    public static void exch(Comparable[] a, int i, int j){
        Comparable temp;
        temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    }
}
